import java.util.Scanner;

public class a149_乘乘樂 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int m;
		
		String input;
		String each_str;
		Long result;
		
		while(sc.hasNext()) {
			m = sc.nextInt();
			
			sc.nextLine();
			
			for(int i = 0; i < m; i++) {
				input = sc.nextLine();
				
				result = (long)1;
				for(int j = 0; j < input.length(); j++) {
					result *= Integer.parseInt(input.substring(j, j + 1));
				}
				
				System.out.println(Long.toString(result));
			}
		}
	}
	
}